home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / Dots & Pixels / headers / soundchannel.h < prev    next >
C/C++ Source or Header  |  1995-09-29  |  933b  |  43 lines

  1. #pragma once
  2.  
  3. #ifndef __CONDITIONALMACROS__
  4.     #define SndListHandle Handle
  5. #endif
  6.  
  7. class soundchannel
  8. {
  9.     public:
  10.     
  11.         soundchannel();
  12.         ~soundchannel();
  13.  
  14.         void playsound( const int resourceno) const;
  15.         void playsound( SndListHandle thesound) const;
  16.         void setamplitude( unsigned char amp) const;
  17.         void playnote( int half_millis, long frequency) const;
  18.         void rest( int half_millis) const;
  19.         void hush() const;
  20.  
  21.     private:
  22.         SndChannelPtr thechannel;
  23.         
  24.         void sendcommand( short cmd, short param1, long param2) const;
  25.         void sendImmediate( short cmd, short param1, long param2) const;
  26. };
  27.  
  28. inline void soundchannel::playnote( int half_millis, long frequency) const
  29. {
  30.     sendcommand( freqDurationCmd, half_millis, frequency);
  31. }
  32.  
  33. inline void soundchannel::rest( int half_millis) const
  34. {
  35.     sendcommand( restCmd, half_millis, 0);
  36. }
  37.  
  38. inline void soundchannel::hush() const
  39. {
  40.     sendImmediate( flushCmd, 0, 0);
  41.     sendImmediate( quietCmd, 0, 0);
  42. }
  43.